import json
import requests


def get_openid(code):
    appid = "wx62f541116b29f71a"
    secret = "ebe5a071e186318bd52adb47d08a607c"
    grant_type = "authorization_code"
    url = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code"% (appid,secret,code)
    res = requests.get(url)
    print(res.text)
    return json.loads(res.text)


